fix: use correct ref and path for features when useBuildContexts is true#205
fix: use correct ref and path for features when useBuildContexts is true#205
Conversation
|
I'm the one who added this code path. I was using it externally to generate a Besides not working, this new implementaiton seems wrong because it ignores the tag specified with the feature. Would it be okay to revert this? |
|
@aaronlehmann Can you elaborate a bit more on
Ack 👍 A failing sample would be nice. |
|
This code path is outside of envbuilder: I import the I realize that asking you to maintain a code path you don't actually use is a big ask. I was hoping to avoid maintaining an envbuilder fork, and the |
|
@aaronlehmann could you share a diff between the Dockerfile this used to produce and the new one? I didn't quite catch what it is that broke in your use case. IMO the goal is to be truthful to the spec so if we diverged where we didn't before, happy to look into it. |
|
Diff from before this change to after this change: With my builder, the new Dockerfile fails with I provide build contexts with names using the keys in "features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "1.22.3"
}
} |
|
BTW, the post-change code seems to work correctly if I add the build context with the name diff --git a/devcontainer/devcontainer.go b/devcontainer/devcontainer.go
index 0454440..f7d97de 100644
--- a/devcontainer/devcontainer.go
+++ b/devcontainer/devcontainer.go
@@ -295,7 +295,7 @@ func (s *Spec) compileFeatures(fs billy.Filesystem, devcontainerDir, scratchDir
}
featureDirectives = append(featureDirectives, directive)
if useBuildContexts {
- featureContexts[featureName] = featureDir
+ featureContexts[featureRef] = featureDir
lines = append(lines, fromDirective)
}
} |
This needs to be updated to correspond to the changes in coder#205.
This needs to be updated to correspond to the changes in coder#205.
This needs to be updated to correspond to the changes in coder#205.
|
Opened a PR for this here: #243 |
|
Another unfortunate side effect of this PR is that it produces Dockerfiles with nondeterministic paths, i.e.: This means Dockerfiles involving features can't be cached. Any concerns with switching back to the old target paths (or something else that's deterministic)? |
…ontexts This avoids caching issues when using the Dockerfile produced in useBuilContexts mode. See coder#205 (comment) for context.
…ontexts This avoids caching issues when using the Dockerfile produced in useBuildContexts mode. See coder#205 (comment) for context.
|
I opened #247 to make the target path determinstic - feel free to discuss over there. |
…ontexts This avoids caching issues when using the Dockerfile produced in useBuildContexts mode. See coder#205 (comment) for context.
…ontexts This avoids caching issues when using the Dockerfile produced in useBuildContexts mode. See coder#205 (comment) for context.
This PR fixes an unused functionality for using build context for dev container features that was behind a boolean flag.
The functionality can be enabled like this:
It's a bit unclear to me whether or not we will need to use this code-path. It depends if feature files should be available in the image or not, in which case the
RUN --mountwould need to become aCOPY. Since I investigated this though, I decided to push the fix as well.